package com.yuqian.JavaSe.thread.cands;

public class Producer<T> {
	private Product<T> product;
	
	Producer(Product<T> product){
		this.product =product;
	}
	
	public void produceProduct(T pro) {
		synchronized (this.product) {
			if(this.product.getProducts().size()==this.product.getMaxSize()) {
				try {
					this.product.wait();
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}else {
				this.product.getProducts().addFirst(pro);
				System.out.println("生产者生产一个产品");
				this.product.notifyAll();
			}
		}
	}
	
	<V> Product<V> get(){
		return null;
	}
}
